import Data.List

panDigitalNumbers :: [String]
panDigitalNumbers = filter reject $ map concat (permutations (map show [0..9]))
	where
	reject text = 
		(read (subList 3 1 text)) `mod` 2 == 0 &&
		(read (subList 3 2 text)) `mod` 3 == 0 &&
		(read (subList 3 3 text)) `mod` 5 == 0 &&
		(read (subList 3 4 text)) `mod` 7 == 0 &&
		(read (subList 3 5 text)) `mod` 11 == 0 &&
		(read (subList 3 6 text)) `mod` 13 == 0 &&
		(read (subList 3 7 text)) `mod` 17 == 0
			where
			subList n m xs = (take n.drop m) xs 
			
euler_042 = sum $ map read panDigitalNumbers